/**
 * @type {String}
 *
 * @properties={typeid:35,uuid:"0880DC62-97CE-4E71-AC6C-4087780EF764"}
 */
var $pwd_original = "";

/**
 * @type {String}
 *
 * @properties={typeid:35,uuid:"AD3280F4-629E-4ADF-9C38-4262BD174499"}
 */
var $pwd1 = "";

/**
 * @type {String}
 *
 * @properties={typeid:35,uuid:"F01735B8-F08C-4C1C-893E-AEF19C8B0A70"}
 */
var $pwd2 = "";

/**
 * Comprueba contraseñas
 * @author Roberto J. Blasco
 * @version 1.0
 * @param {JSEvent} event
 * @return {Boolean}
 * @properties={typeid:24,uuid:"5EF67B23-B001-43F6-B29B-0A76DBC84404"}
 */
function aceptar_antes(event){
	
	return true;
}

/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @private
 *
 * @properties={typeid:24,uuid:"A2EAA399-83AE-4913-9E78-CA44845B55AC"}
 */
function onShow(firstShow, event) {

	$pwd_original = null;
	$pwd1 = null;
	$pwd2 = null;
}

/**
 * Cancelar
 * @author Roberto J. Blasco
 * @version 1.0
 * @param {JSEvent} event the event that triggered the action
 * @private
 * @properties={typeid:24,uuid:"2DA378A8-6669-405A-B197-4EF1AE1D34C9"}
 */
function cancelar(event) {

	
}

/**
 * Aceptar
 * @author Roberto J. Blasco
 * @version 1.0
 * @param {JSEvent} event the event that triggered the action
 * @return {Boolean}
 * @private
 * @properties={typeid:24,uuid:"1E1EC961-61DF-447C-9D94-7CC2A9856082"}
 */
function aceptar(event) {

	// TODO Revisar condiciones
	if (s_md5_pwd != utils.stringMD5HashBase64($pwd_original)){
		application.output("Las contraseñas no coinciden");
		return false;
	}else if ($pwd1 != $pwd2){
		application.output("Las contraseñas no coinciden");
		return false;
	}
	
	s_md5_pwd = utils.stringMD5HashBase64($pwd1);
	globals.saveEdits_record(foundset.getSelectedRecord());
	
	return true;
}
